<script setup lang="ts">
import { User, Lock, Warning } from '@element-plus/icons-vue'
import loginFn from '@/hooks/fun/login';
const { loading, user, loginForm, form, rules, login } = loginFn()
</script>

<template>
  <span>
    <div class="videoContainer">
      <video class="fullscreenVideo" id="bgVid" playsinline autoplay muted loop>
        <source src="@/assets/video.3cf57b17.mp4" type="video/mp4">
      </video>
    </div>
    <div class="loginBox">
      <h1><img class="img" src="@/assets/img/logo1.33ef7fa0.png" alt=""></h1>
      <el-form ref="form" :model="loginForm" :rules="rules">
        <el-form-item prop="account">
          <el-input :prefix-icon="User" class="input" clearable v-model="loginForm.account" size="large"
            placeholder="请输入账号" />
        </el-form-item>
        <el-form-item prop="password">
          <el-input :prefix-icon="Lock" class="input" clearable type="password" show-password size="large"
            v-model="loginForm.password" placeholder="请输入密码" />
        </el-form-item>
        <el-form-item prop="code">
          <el-input @keyup.enter.native="login(form)" :prefix-icon="Warning" class="input" size="large"
            v-model="loginForm.code" placeholder="请输入验证码">
            <template #suffix>
              <el-image style="cursor: pointer;" @click="user.getCode()" :src="user.code"></el-image>
              <!-- <img src="@/assets/img/ceshi.png" alt=""> -->
            </template>
          </el-input>
        </el-form-item>
        <el-form-item>
          <el-button @click="login(form)" :loading="loading" color="#e15536" class="btn" size="large">登录</el-button>
        </el-form-item>
      </el-form>
    </div>
  </span>
</template>

<style scoped lang="scss">
.loginBox {
  box-sizing: border-box;
  position: absolute;
  left: 50%;
  top: 50%;
  background-color: #fff;
  width: 450px;
  height: 467px;
  z-index: 999;
  transform: translate(-50%, -50%);
  border-radius: 10px;
  padding: 36px 40px;

  h1 {
    text-align: center;
  }

  .img {
    width: 200px;
  }

  .btn {
    width: 100%;
  }

  .input {
    width: 370px;
    height: 50px;
  }

  ::v-deep .el-input {
    .el-icon {
      font-size: 20px;
    }
  }
}

.videoContainer {
  position: fixed;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  z-index: -100;
  opacity: .7;
}

video {
  height: 115%;
}

.videoContainer:before {
  content: "";
  position: absolute;
  width: 100vw;
  height: 100vh;
  display: block;
  z-index: -1;
  top: 0;
  left: 0;
  background: rgba(25, 29, 34, .65);
}
</style>